package com.beiding.jsonanalyzer.flow;

/**
 * 刷新事件
 * 不对外暴露
 */
public class FlushEvent<W> implements FlowEvent<W> {

    /**
     * 刷新完成时的回调
     */
    private final Runnable callback;

    /**
     * 外部无法创建该事件
     * @param callback
     */
    FlushEvent(Runnable callback) {
        this.callback = callback;
    }

    /**
     * 获取回调
     *
     * @return
     */
    public Runnable getCallback() {
        return callback;
    }

    private static final FlushEvent TYPE_INSTANCE = new FlushEvent(null);

    /**
     * 类型
     *
     * @param <T>
     * @return
     */
    public static <T> FlushEvent<T> type() {
        return TYPE_INSTANCE;
    }

}
